<template>
	<div>
		<!-- 用餐人数，默认1人 -->
		<div style="display: flex;margin-top: 10%;margin-left: 20%;">
			<van-tag type="primary" size="large" style="margin-top: 3%;margin-right: 3%;">用餐人数</van-tag>
			<van-field v-model="peo_num" placeholder="用餐人数"
				@input="peo_num_input" />
		</div>
		<!-- 上报 -->
		<div style="position: fixed;bottom: 10%;width: 100%;">
			<van-button block color="#1989fa" @click="up_food_num()">报餐</van-button>
		</div>
	</div>
</template>

<script>
	import { BaseUrl } from '@/util/util.js';
	const PrefixUrl = BaseUrl();
	export default {
		data(){
			return{
				peo_num: '1'
			}
		},
		onLoad: function(option) {
			
			
		},
		created() {
			
		},
		methods:{
			peo_num_input(event) {
				this.peo_num = event.detail;
			},
			up_food_num(){
				uni.request({
					method: 'POST',
					url: PrefixUrl + '/imdFoodPeoNum/UpFoodpeoNum',
					data: {
						time: new Date().getHours(),
						num: this.peo_num
					},
					header: {
						'content-type': 'application/x-www-form-urlencoded',
						'token': uni.getStorageSync('token')
					},
					success: (res) => {
						if (res.data.obj){
							uni.showToast({
								title: '报餐成功!',
								mask: true,
								icon: 'none'
							})
						}
					}
				});
			}
		}
	} 
</script>

<style>
</style>